/**
 * 
 */
package com.app.dao.impl;

import java.io.Serializable;

import org.apache.log4j.Logger;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.app.dao.ICornDbExcelDao;
import com.app.dao.po.CornDbDnaExcel;
import com.app.service.vo.CornDbDnaExcelVo;

/**
 * @author Administrator
 *
 */
public class CornDbExcelDaoImpl extends HibernateDaoSupport implements ICornDbExcelDao{

	/**
	 * 
	 */
	public CornDbExcelDaoImpl() {
		logger.info(this.getClass().getName()+" loader");
	}
	private static Logger logger = Logger.getLogger(CornDbExcelDaoImpl.class);
	
	@Override
	public String saveCornDbDnaExcelVo(CornDbDnaExcelVo vo) {
		Serializable s = this.getHibernateTemplate().save(vo.parsePo(new CornDbDnaExcel()));
		return s.toString();
	}
	@Override
	public CornDbDnaExcelVo getById(String id) {
		CornDbDnaExcel po = this.getHibernateTemplate().get(CornDbDnaExcel.class, id);
		return (CornDbDnaExcelVo) new CornDbDnaExcelVo().parseVo(po);
	}
	@Override
	public int statByParam(String sql){
		Object o = this.getSession().createSQLQuery("select count(id) from corn_db_dna_excel where 1=1 "+sql).uniqueResult();
		return o==null?0:Integer.parseInt(o.toString());
	}

}
